using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLCG.DAO
{
public class tblLoaiCongViecUI
{ 
	private int idLoaiCV;
	public int IdLoaiCV
	{
		get { return idLoaiCV;}
		set { idLoaiCV = value;}
	}

	private String tenLoaiCV;
	public String TenLoaiCV
	{
		get { return tenLoaiCV;}
		set { tenLoaiCV = value;}
	}

	private String moTa;
	public String MoTa
	{
		get { return moTa;}
		set { moTa = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	public tblLoaiCongViecUI() {}

	public tblLoaiCongViecUI(int idLoaiCV, String tenLoaiCV, String moTa, DateTime ngayTao)
	 {
		this.idLoaiCV = idLoaiCV;
 		this.tenLoaiCV = tenLoaiCV;
 		this.moTa = moTa;
 		this.ngayTao = ngayTao;
 	}

	public int Add(String tenLoaiCV, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLoaiCongViec_Add",tenLoaiCV,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idLoaiCV, String tenLoaiCV, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLoaiCongViec_Update",idLoaiCV,tenLoaiCV,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idLoaiCV)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLoaiCongViec_Delete",idLoaiCV);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLoaiCongViec_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idLoaiCV)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblLoaiCongViec_Get",idLoaiCV);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblLoaiCongViec_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
